feat: replace sidebar NSOutlineView with SwiftUI List#234
Merged
Conversation
Replace the Editor.xib sidebar (NSOutlineView + Cell + ListController) with a SwiftUI List, following the same pattern established in PR #227 for URLSheet. New files: - HostsDataStore: ObservableObject singleton bridging ObjC notifications - HostsRowView: SF Symbol-based row replacing 400-line custom Cell drawing - SidebarView: SwiftUI List with drag-and-drop, context menus, inline rename - SidebarInstaller: @objc bridge that swaps the XIB pane at runtime ObjC changes: - HostsMainController: add selectHosts: for programmatic selection - ListController: add deactivate to remove duplicate notification observers - EditorController: call SidebarInstaller from awakeFromNib
- Add confirmation dialog before removing hosts files - Move .onDrop to per-Section for group-aware drops (files land in the correct group instead of always the first one) - Handle multi-file drops (process all URL providers, not just first) - Remove .utf8PlainText from drop types (was accepted but never handled) - Show empty group sections so users can drop into them - Replace deprecated onCommit with .onSubmit - Suppress unused result warning on loadObject
Resolve conflicts in project.pbxproj and bridging header by keeping entries from both branches.
- Combine duplicate .allHostsFilesLoadedFromDisk observer into one - Remove unreachable deinit from singleton HostsDataStore - Fix row refresh: reassign hostsGroups instead of objectWillChange.send() - Change removeHostsFile to moveToTrash:true for user recovery - Add comment explaining dispatch_async in selectHosts:
10 tasks
2ndalpha
added a commit
that referenced
this pull request
Mar 1, 2026
…237) Replace the 515-line Editor.xib and ~28 legacy ObjC files (~2800 LOC) with a programmatic NSWindow containing a single SwiftUI EditorView root. This is the final step (PR 3 of 3) in the editor modernization series, following the sidebar (#234) and content area (#236) SwiftUI migrations. New SwiftUI components: - EditorView: root view with NavigationSplitView, owns @StateObject HostsDataStore - EditorToolbar: 4 toolbar items using SF Symbols (plus, minus, square.and.arrow.down, power) - StatusBarView: files count label, read-only lock icon, busy spinner - EditorWindowPresenter: @objc bridge creating NSWindow programmatically Key changes: - HostsDataStore converted from singleton to @StateObject-owned instance - Busy indicator moved from ApplicationController to HostsDataStore with thread-safe notification observers (queue: .main) - Toolbar Remove now uses moveToTrash:true (reversible) matching sidebar - Window lifecycle (open/close/reopen, dock show/hide) preserved
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the Editor.xib sidebar (
NSOutlineView+Cell+ListController) with a pure SwiftUIList, following the same pattern established in PR #227 forURLSheet. This is PR 1 of 3 in the incremental Editor.xib modernization:New Swift files
HostsDataStore—ObservableObjectsingleton that bridges ObjCNSNotificationCenterevents to@Publishedproperties for SwiftUI reactivity. Mirrors the PCH notification name macros asNSNotification.Nameextensions.HostsRowView— SF Symbol-based row view replacing the 400-line customCell.mdrawing code. Shows active/unsaved/error/syncing/offline badges with accessibility labels.SidebarView— SwiftUIList(selection:)with sections perHostsGroup, context menus (save, activate, show in Finder, open in browser, move, rename, remove), inline rename with validation, and drag-and-drop viaSidebarDropDelegate.SidebarInstaller—@objcbridge called fromEditorController.mto swap the XIB's left pane with anNSHostingViewat runtime.ObjC changes
HostsMainController— AddedselectHosts:method for programmatic selection from Swift.ListController— Addeddeactivatemethod that removes all notification observers, preventing duplicate handling when SwiftUI takes over.EditorController— Calls[SidebarInstaller installIn:splitView]at end ofawakeFromNib.Node,Hosts,HostsGroup,RemoteHosts,CombinedHosts,Preferences,Error,LocalHostsController,CombinedHostsController,ListController.Tests
HostsDataStoreTests— Notification name constants match ObjC defines, singleton identity, rename/select notification handling.Test plan
xcodebuild build)xcodebuild test)